home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / TEXPLIST.ZIP / demo / Delphi 2 & 3 / people.pas next >
Encoding:
Pascal/Delphi Source File  |  1999-01-30  |  1.8 KB  |  68 lines

  1. unit people;
  2.  
  3. {*** Ignore everything in this unit, it's only my Random People Generator (tm) code ***}
  4.  
  5. interface
  6.  
  7. uses ComCtrls;
  8.  
  9. procedure GeneratePeople(aListView: TListView);
  10.  
  11. implementation
  12.  
  13. uses Windows, Forms, Controls, SysUtils;
  14.  
  15. procedure GeneratePeople(aListView: TListView);
  16. type
  17.   TRandPerson = array [1..10] of string;
  18. const
  19.   cLastName: TRandPerson   = ('Smith', 'Bradshaw', 'Jennings', 'Deneuve', 'Morrison', 'Churchill',
  20.                               'Brown', 'Green', 'Arnold', 'Washington');
  21.  
  22.   cFirstName: TRandPerson  = ('Jeff', 'Craig', 'Walter', 'Scot', 'Joe', 'Frank',
  23.                               'Cathy', 'Anne', 'Victoria', 'Stephanie');
  24.  
  25.   cOccupation: TRandPerson = ('Cook', 'Programmer', 'Engineer', 'Driver', 'Storekeeper',
  26.                               'Accountant', 'Manager', 'Artist', 'Musician', 'Lawyer');
  27.  
  28.   cHobby: TRandPerson      = ('Skiing', 'Fishing','Collecting', 'Drawing', 'Skating', 'Dancing',
  29.                               'Watching TV', 'Movies', 'Cooking','Shopping');
  30.  
  31.   cNumPeople = 50;
  32.  
  33.   function GetRandom(r: Integer): Integer;
  34.   begin
  35.     Randomize;
  36.     Sleep(7);
  37.     Result := Random(r-1) + 1;
  38.   end;
  39.  
  40. var
  41.   i: Integer;
  42.  
  43. begin
  44.   { Ignore all code in this event handler... It's my Automatic People Generator (tm)}
  45.     with aListView do
  46.     try
  47.       Screen.Cursor := crHourglass;
  48.       Items.BeginUpdate;
  49.  
  50.       for i := 1 to cNumPeople do
  51.         with Items.Add do
  52.         begin
  53.           Caption := cLastName[GetRandom(10)];
  54.           SubItems.Add(cFirstName[GetRandom(10)]);
  55.           SubItems.Add(IntToStr(GetRandom(50) + 18));
  56.           SubItems.Add(cOccupation[GetRandom(10)]);
  57.           SubItems.Add(cHobby[GetRandom(10)]);
  58.         end;
  59.  
  60.     finally
  61.       Items.EndUpdate;
  62.       Screen.Cursor := crDefault;
  63.     end;
  64.  
  65. end;
  66.  
  67. end.
  68.